package com.shouer.doc.dialog;

import android.content.Context;
import android.view.View;

import com.shouer.doc.R;

/**
 * Created by yangyayun on 2016/12/30.
 */

public class GetCashApplyDialogUtil implements DialogDismissListener{

    private static GetCashApplyDialogUtil instance;
    private GetCashApplyDialog mDialog;

    public GetCashApplyDialogUtil() {
    }

    public static GetCashApplyDialogUtil getInstance() {
        if (instance == null) {
            synchronized (GetCashApplyDialogUtil.class) {
                if (instance == null) {
                    instance = new GetCashApplyDialogUtil();
                }
            }
        }
        return instance;
    }

    public void show(Context context, View.OnClickListener listener, String message) {

        if (null == mDialog || !mDialog.isShowing()) {
            mDialog = new GetCashApplyDialog(context, R.style.dialog_untran);
        }
        mDialog.withDialogDismissListener(this);
        mDialog.withMessage(message);
        mDialog.withBtnClickListener(listener);
        mDialog.show();
    }

    public void dismiss() {
        if (null != mDialog && mDialog.isShowing()) {
            mDialog.dismiss();
        }
    }


    @Override
    public void onDialogDismiss() {
        if (null!=mDialog)
        {
            mDialog=null;
        }
    }
}
